<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h:form id="pesForm" enctype="multipart/form-data">
                <br/>
                <h2 class="title">Relatório BCI</h2>

                <p:growl id="messages" showDetail="true" autoUpdate="true"  /> 
                <div class="row">
                    <div class="twelve columns"> 
                        <br/>
                        <h4 class="title">Proprietário</h4>
                        <p:panel id="pesPanel" style="background: none; border: none;" 
                                 styleClass="container_24 clearfix ">



                            <p:outputLabel value="Proprietario: "  styleClass="grid_3"/>
                            <p:selectOneRadio id="typePerson" 
                                              value="#{managerImovel.pesProprietario.tipoDocumento}" >  
                                <f:selectItems value="#{managerImovel.tipoDocumento()}" />
                                <p:ajax event="change" update=":pesForm:pesPanel" 
                                        />
                            </p:selectOneRadio>

                            <div class="clear"/>

                            <p:outputLabel id="typeDocumentLabel" 
                                           value="#{managerImovel.pesProprietario.tipoDocumento}: " 
                                           styleClass="grid_3"/>

                            <p:inputMask id="typeDocumentInput" 
                                         value="#{managerImovel.pesProprietario.tipoDocumento.tipo eq 'CPF' ? 
                                                  managerImovel.pesProprietario.cpf : managerImovel.pesProprietario.cnpj}"
                                         mask="#{managerImovel.pesProprietario.tipoDocumento.tipo eq 'CPF' ? 
                                                 '999.999.999-99':'99.999.999/9999-99'}" 
                                         styleClass="grid_8" > 

                            </p:inputMask>
                            <div class="clear"/>
                            <p:outputLabel value="Nome: " styleClass="grid_3" for="nomeInputText" 
                                           rendered="#{managerImovel.pesProprietario.tipoDocumento.tipo eq 'CPF'}"/>
                            <p:inputText id="nomeInputText" styleClass="grid_20 ajustInput" 
                                         value="#{managerImovel.pesProprietario.nome}" 
                                         rendered="#{managerImovel.pesProprietario.tipoDocumento.tipo eq 'CPF'}" />

                            <p:outputLabel value="Fantasia: " styleClass="grid_3" for="nameFantasyInputText" 
                                           rendered="#{managerImovel.pesProprietario.tipoDocumento.tipo eq 'CNPJ'}" />
                            <p:inputText id="nameFantasyInputText" styleClass="grid_20 ajustInput"
                                         value="#{managerImovel.pesProprietario.nomeFantasia}" 
                                         rendered="#{managerImovel.pesProprietario.tipoDocumento.tipo eq 'CNPJ'}" />

                        </p:panel>

                        <div class="clear"/>


                        <h4 class="title">Endereço</h4>
                        <p:panel id="addressPanel" style="background: none; border: none;" 
                                 styleClass="container_24 clearfix ">

                            <p:outputLabel value="CEP:" styleClass="grid_3" for="cepInputMask" />
                            <p:inputMask id="cepInputMask" styleClass="grid_4" mask="99.999-999"
                                         value="#{managerImovel.pesEndereco.cep}" />
                            <div class="clear-both" />

                            <p:outputLabel value="Logradouro:" styleClass="grid_3   " for="patioInputText" />
                            <p:inputText id="patioInputText" styleClass="grid_20"
                                         value="#{managerImovel.pesEndereco.logradouro}" />

                            <p:outputLabel value="Bairro:" styleClass="grid_3" for="neighborhoodInputText" />
                            <p:inputText id="neighborhoodInputText" styleClass="grid_20"
                                         value="#{managerImovel.pesEndereco.bairro}" />

                        </p:panel>
                        <div class="clear"/>
                        <br/>

                        <h4 class="title">Dados Gerais</h4>
                        <p:panel id="dadosPanel" style="background: none; border: none;" 
                                 styleClass="container_24 clearfix "> 
                            <h5 class="title">Patrimônio</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerImovel.pesImovel.patrimonio}">
                                <f:selectItems value="#{managerImovel.patrimonioList}"  />
                            </p:selectOneRadio>
                            <br/>
                            <div class="clear"/>
                            <h5 class="title">Composição Familiar</h5>
                            <p:selectOneRadio styleClass="grid_14" layout="" value="#{managerImovel.pesImovel.composicaoFamiliar}">
                                <f:selectItems value="#{managerImovel.composicaoFamiliar}"/>
                            </p:selectOneRadio>
                            <br/>
                            <div class="clear" />
                            <h5 class="title">Possue registro de imóvel ?</h5>
                            <p:selectOneRadio styleClass="grid_3" value="#{managerImovel.pesImovel.regImovel}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>
                            <br/>
                            <div class="clear"/>
                            <h5 class="title">Paga iptu ?</h5>
                            <p:selectOneRadio styleClass="grid_3" value="#{managerImovel.pesImovel.pagaIptu}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>
                            <div class="clear"/>
                            <h5 class="title">Minha casa minha vida ?</h5>
                            <p:selectOneRadio styleClass="grid_3" value="#{managerImovel.pesImovel.minhaCasaMinhaVida}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>

                            <div class="clear"/>
                        </p:panel>
                        <br/>
                        <div class="buttonAction">
                            <p:commandButton value="Visualizar" icon="ui-icon-search"
                                             update="@form"
                                             ajax="false"
                                             onclick="this.form.target='_blank'"
                                             actionListener="#{managerImovel.reportRegImovel()}"
                                             styleClass="ui-priority-primary" />

                            <p:button value="Voltar" icon="ui-icon-arrowreturnthick-1-w"
                                      />
                        </div >
                    </div>
                </div>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
